# Maintainer: Ariadne Conill <ariadne@dereferenced.org>
pkgname=remake
pkgver=1.5
pkgrel=1
pkgdesc="a utility for managing collections of software build artifacts"
url="https://github.com/rocky/remake"
arch="all"
license="GPL-3.0-or-later"
makedepends="readline-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-make:_make"
source="https://sourceforge.net/projects/bashdb/files/remake/4.3%2Bdbg-$pkgver/remake-4.3%2Bdbg-$pkgver.tar.gz"
builddir="$srcdir/remake-4.3+dbg-$pkgver"

build() {
	CFLAGS="$CFLAGS -fcommon" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-nls
	make
}

check() {
	[ "$CBUILD" != "$CHOST" ] || (ulimit -n 64 && PERL5LIB=. make check)
}

package() {
	make DESTDIR="$pkgdir" install
}

_make() {
	pkgdesc="$pkgdesc (make symlink)"
	provides="make=4.3"

	mkdir -p "$subpkgdir"/usr/bin
	ln -sf remake "$subpkgdir"/usr/bin/make
}

sha512sums="90aa9674ed5d88b72fda5a99a103d0b1a643d10b18c1de1186478b026f6b4da73628bff75a180df880157b5cbfff1bfd782f4ee81880e0635d79113fcc0f7497  remake-4.3%2Bdbg-1.5.tar.gz"
